@extends('admin.layout')
@section('title')
 角色列表
@endsection
@section('body')
 <div class="widget-body">
  <form role="form" class="form-inline widget">
   <div class="form-group">
    <input type="text" name="name" placeholder="角色名称" class="form-control" value="{{$name}}">
   </div>
   <button class="btn btn-default" type="submit">搜索</button>
   <button class="btn btn-default" type="button" onclick="location.href='{{action(NAMESPACE_ADMIN.'RoleController@getAdd')}}';">添加</button>
  </form>
  <div class="widget">
   <table class="table table-bordered table-hover">
    <thead>
    <tr>
     <th>ID</th>
     <th>角色名称</th>
     <th>状态</th>
     <th>操作</th>
    </tr>
    </thead>
    <tbody>
     @foreach($roles as $key=>$item)
      <tr>
       <td>{{$item['id']}}</td>
       <td>{{$item['name']}}</td>
       <td>{{$item['status']==1?'正常':'禁用'}}</td>
       <td>
        <a href="{{action(NAMESPACE_ADMIN.'RoleController@getEdit',['id'=>$item['id']])}}">修改</a>|
        <a href="#" onclick="if(confirm('确认删除?')) location.href='{{action(NAMESPACE_ADMIN.'RoleController@getDel',['id'=>$item['id']])}}';">删除</a>
       </td>
      </tr>
     @endforeach
    </tbody>
   </table>
  </div>
  <div class="widget">
    <div class="pull-left">共{{ $roles->total() }}条记录</div>
    <div class="pull-right">{!! $roles->appends($name)->render() !!}</div>
    <div style="clear: both"></div>
  </div>
 </div>
 </div>
@endsection